<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="../../common/jspcommon.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>邮箱激活</title>
<%@include file="../../common/js.jsp" %>
<%@include file="../../common/css.jsp" %>
<link type="text/css" rel="stylesheet" href="/css/v4/detail.css"/>
<!--[if ie]><link type="text/css" rel="stylesheet" href="/css/v4/common/IE.css"><![endif]-->
<style type="text/css">
	label.error{color: #f69; padding:0 0 0 90px;}
</style>
</head>
<body>
    <%@include file="../../common/header.jsp" %>
    <%@include file="../menu.jsp" %>
    <div class="w100p pt35 pb35">
    	<div class="w980 mg ">
            <div class="box_s6">
                <div class="l_r_box">
                	<h1>邮箱验证</h1>	
                    <div class="v_mail_box">
                    	<h3 class="title">验证您的邮箱是否真实，是保证返利提现、参加活动等任务的必要条件</h3>
                        <p class="mail_info">你填写的邮箱地址：<span id="myEmail">${member.email }</span> <a href="javascript:void(0)" class="mail_change">更换邮箱</a><a href="javascript:void(0)" id="activeEmail" class="def_btn_s12">发送验证邮件</a></p>
                        <div class="send_tip" style="display: none;">
                        	验证邮件已经发到您163.com邮箱，<a href="">马上去邮箱验证</a>
                        </div>
                        <form action="/member/activemail.htm" method="post" id="email_form">
                        <ul class="l_r_layout new_addr" style="display: none;" id="change_mail">
                        	<li>
                            	<label class="def_lbl">新邮箱地址：</label><input type="text" class="def_text_1 focus" name="email" id="email"/>
                            	<input type="submit" class="def_btn_s12 ml10" value="确定"/><br class="clear" />
                            </li>
                        </ul></form><p class="send_tip_s1">果果街将发送一封电子邮件到您的邮箱中，您只需按照提示点击验证链接即可</p>
                    </div>
                    
                </div>
                <p class="lr_copy">©2011-2012 果果街 增值电信业务经营许可证：沪B2-20110080 沪ICP备11003519号</p>
                <div class="shadow"></div>
            </div>
       	</div>		
    </div>
<script type="text/javascript">
	$(function(){
		$("#activeEmail").click(function(){
			var email="${member.email }";
			var activeEmail=$("#email").val();
			if(activeEmail!=''&& activeEmail!=null){
				email=activeEmail;
			}
			$.post("/member/active.htm",function(data){
				if(data=="success"){
					$(this).unbind('click');
					var url="http://mail." + email.substring(email.indexOf("@") + 1);
					var e=email.substring(email.indexOf("@") + 1);
					if(url=="http://mail.gmail.com"){
						url="http://mail.google.com";
					}
					$(".send_tip").show().html('验证邮件已经发到您'+e+'邮箱，<a target="_blank" href="'+url+'">马上去邮箱验证</a>');
				}
			});
		});
		$(".mail_change").click(function(){
			$("#change_mail").toggle();
		});
		$("#email_form").validate(
				{
					errorClass:"error",
					success : function(label) {
						label.text("").addClass("register_success");
					},
					errorPlacement: function(error,element) {
						 error.appendTo(element.parent("li"));
					},
					rules : {
						email : {required : true,email : true,remote : '/member/checkemail.htm',maxlength : 50}
					},
					messages : {
						email : {required : "请填写邮箱",email : "请填写正确的邮箱地址",remote : "该邮箱已被注册",maxlength : "请输入正确的邮箱地址"}
					},
					submitHandler:function(form) {
						$(form).ajaxSubmit(function(data){
							if(data=="success"){
								$("#myEmail").html($("#email").val());
								$("#change_mail").hide();
								$("#email").val("");
							}
						});
					}
				});
	});
	
</script>
</body>
</html>